package com.example.smartf.repository.mysql;

import com.example.smartf.model.mysql.Userinfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import javax.transaction.Transactional;
import java.util.List;

public interface UserinfoRepository extends JpaRepository<Userinfo,String> {
    //查找（通过username）
    Userinfo findByUsername(String username);

    //查找所有


    @Transactional
    @Modifying
    @Query("update Userinfo set password= :newpassword where username= :username")
    int resetPassword(@Param("username") String username,@Param("newpassword") String newpassword);
}
